class Boil {
  final String avatar;
  final String username;
  final String content;
  final String hotComment;
  final int commentCount;

  Boil(
      {required this.avatar,
      required this.username,
      required this.content,
      required this.hotComment,
      required this.commentCount});

  factory Boil.fromJson(Map<String, dynamic> json) {
    return Boil(
      avatar: json['avatar'],
      username: json['username'],
      content: json['content'],
      hotComment: json['hotComment'],
      commentCount: json['commentCount'],
    );
  }

  //将类对象转换成JSON字典，方便插入数据库
  Map toJson() {
    return {
      'avatar': this.avatar,
      'username': this.username,
      'content': this.content,
      'hotComment': this.hotComment,
      'commentCount': this.commentCount,
    };
  }
}
